﻿<%@ Page Title="" Language="C#" MasterPageFile="~/DeveloperSite.Master" AutoEventWireup="true" 
    CodeBehind="Submitted_Project_Reports.aspx.cs" Inherits="Amkeni_System.Programme.Submitted_Project_Reports" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <asp:EntityDataSource ID="SubmittedProjectsDataSource" runat="server" 
        ConnectionString="name=Amkeni_DatabaseEntities" DefaultContainerName="Amkeni_DatabaseEntities" 
        EnableFlattening="False" EntitySetName="ip_report"
        Include="year, report_period, implementing_partner, RFP" 
        AutoGenerateWhereClause="True" EnableDelete="True" EnableInsert="True" 
        EnableUpdate="True">
        <WhereParameters>
            <asp:Parameter DefaultValue="true" Name="submitted" Type="Boolean" />
        </WhereParameters>
    </asp:EntityDataSource>

    <asp:Label ID="ContextLabel" runat="server" Text="PROGRAMME REVIEW" CssClass="ContentHead"></asp:Label>
    <br />
    <asp:Label ID="Error" runat="server" Text="" Visible="false" CssClass="ErrorText" ForeColor="Red"></asp:Label>

    <% if (User.IsInRole("Administrator") || User.IsInRole("Programme"))
       { %>
       <asp:GridView ID="GridView2" runat="server" 
            DataSourceID="SubmittedProjectsDataSource" AutoGenerateColumns="false" 
            CssClass="NewGrid" ShowFooter="true" 
            DataKeyNames="ip_id, year_id, report_period_id, RFP_id" 
            OnRowCommand="SubmittedProjectsGridView_RowCommand">
            <AlternatingRowStyle CssClass="NewGridAlt" />
            <FooterStyle CssClass="NewGridFooter" />
            <Columns>
                <asp:TemplateField HeaderText="CALL">
                    <ItemTemplate>
                        <asp:Label ID="Label4" runat="server" TexT='<%# Eval("RFP.RFP_name") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="YEAR">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("year.year1") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="REPORT PERIOD">
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Eval("report_period.period") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="IMPLEMENTING PARTNER" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="400px">
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Eval("implementing_partner.name") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>

                <asp:ButtonField ButtonType="Button" CommandName="view" Text="Access" HeaderText="DATA ENTRY" />
                <asp:ButtonField ButtonType="Button" CommandName="pdf" Text="PDF" HeaderText="DOWNLOAD" />

            </Columns>
        </asp:GridView>
    <% }
       else if (User.IsInRole("IP") && User.IsInRole("Programme"))
       { %>
        <asp:GridView ID="SubmittedProjectsGridView" runat="server" 
            DataSourceID="SubmittedProjectsDataSource" AutoGenerateColumns="false" 
            CssClass="NewGrid" ShowFooter="true" 
            DataKeyNames="ip_id, year_id, report_period_id, RFP_id" 
            OnRowCommand="SubmittedProjectsGridView_RowCommand">
            <AlternatingRowStyle CssClass="NewGridAlt" />
            <FooterStyle CssClass="NewGridFooter" />
            <Columns>
                <asp:TemplateField HeaderText="CALL">
                    <ItemTemplate>
                        <asp:Label ID="Label4" runat="server" TexT='<%# Eval("RFP.RFP_name") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="YEAR">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("year.year1") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="REPORT PERIOD">
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Eval("report_period.period") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="IMPLEMENTING PARTNER" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="400px">
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Eval("implementing_partner.name") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>

                <asp:ButtonField ButtonType="Button" CommandName="view" Text="Access" HeaderText="DATA ENTRY" />
                <asp:ButtonField ButtonType="Button" CommandName="pdf" Text="PDF" HeaderText="DOWNLOAD" />

            </Columns>
        </asp:GridView>
        <% }
       else
       { %>
       <asp:GridView ID="GridView1" runat="server" 
            DataSourceID="SubmittedProjectsDataSource" AutoGenerateColumns="False" 
            CssClass="NewGrid" ShowFooter="True" 
            DataKeyNames="ip_id,year_id,report_period_id,RFP_id" 
            OnRowCommand="SubmittedProjectsGridView_RowCommand">
            <AlternatingRowStyle CssClass="NewGridAlt" />
            <FooterStyle CssClass="NewGridFooter" />
            <Columns>
                <asp:TemplateField HeaderText="CALL">
                    <ItemTemplate>
                        <asp:Label ID="Label4" runat="server" TexT='<%# Eval("RFP.RFP_name") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="YEAR">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("year.year1") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="REPORT PERIOD">
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Eval("report_period.period") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="IMPLEMENTING PARTNER" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="400px">
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Eval("implementing_partner.name") %>'></asp:Label>
                    </ItemTemplate>

                <ItemStyle HorizontalAlign="Left" Width="400px"></ItemStyle>
                </asp:TemplateField>

                <asp:TemplateField HeaderText="DATA ENTRY" ShowHeader="False">
                    <ItemTemplate>
                        <asp:Button ID="Button1" runat="server" CausesValidation="false" 
                            CommandName="view" Text="Access" Enabled="false" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="DOWNLOAD" ShowHeader="False">
                    <ItemTemplate>
                        <asp:Button ID="Button2" runat="server" CausesValidation="false" 
                            CommandName="pdf" Text="PDF" Enabled="false" />
                    </ItemTemplate>
                </asp:TemplateField>

            </Columns>
        </asp:GridView>
       <% } %>

    <%--<p>
        <asp:Label ID="ProjectLabel" runat="server" Text=""></asp:Label><br />
        <asp:Label ID="ReportPeriodLabel" runat="server" Text=""></asp:Label><br />
        <asp:Label ID="YearLabel" runat="server" Text=""></asp:Label>
    </p>--%>

</asp:Content>
